hysop.tools.cache module¶
- hysop.tools.cache.load_attributes_from_cache(filepath, key, instance, attrs, **kwds)[source]¶
Load cached entries from a given file atomically.
Cached data is assumed to be a dictionnary. If key is present in pickled data, try to get all given attributes data by keys given in attrs. Set instance attributes with those values.
If one attribute is missing or key is not present in loaded data, set all values to None in instance and return False.
Return True on success.
- hysop.tools.cache.load_cache(filepath, match_type=<class 'dict'>, on_fail={}, **kwds)[source]¶
Load pickled data from filepath atomically.
- hysop.tools.cache.load_data_from_cache(filepath, key, match_type=<class 'dict'>, on_fail={}, **kwds)[source]¶
Load cached data from a given file atomically with given key.
- hysop.tools.cache.lock_file(filepath, mode, compressed=True, timeout=10, check_interval=0.1, ignore_lock_after_timeout=True)[source]¶
Opens a locked file with specified mode, possibly compressed.
- hysop.tools.cache.read_only_lock(filepath, compressed=True, **kwds)[source]¶
Opens a locked read only file, possibly compressed.